import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ThirdSellerInfoVO, ThirdSellerInfoForm, ThirdSellerInfoQuery } from '@/api/lingxing/thirdSellerInfo/types';

/**
 * 查询多平台店铺列表
 * @param query
 * @returns {*}
 */

export const listThirdSellerInfo = (query?: ThirdSellerInfoQuery): AxiosPromise<ThirdSellerInfoVO[]> => {
  return request({
    url: '/lingxing/thirdSellerInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询多平台店铺详细
 * @param id
 */
export const getThirdSellerInfo = (id: string | number): AxiosPromise<ThirdSellerInfoVO> => {
  return request({
    url: '/lingxing/thirdSellerInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增多平台店铺
 * @param data
 */
export const addThirdSellerInfo = (data: ThirdSellerInfoForm) => {
  return request({
    url: '/lingxing/thirdSellerInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改多平台店铺
 * @param data
 */
export const updateThirdSellerInfo = (data: ThirdSellerInfoForm) => {
  return request({
    url: '/lingxing/thirdSellerInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除多平台店铺
 * @param id
 */
export const delThirdSellerInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/thirdSellerInfo/' + id,
    method: 'delete'
  });
};

/**
 * 同步领星接口
 * @returns {*}
 */
export const syncData = (query?: ThirdSellerInfoQuery) => {
  return request({
    url: '/lingxing/thirdSellerInfo/syncData',
    method: 'post',
    data: query
  });
};

export const getNewestUpdateTime = () => {
  return request({
    url: '/lingxing/thirdSellerInfo/getNewestUpdateTime',
    method: 'get'
  });
};
